package pip.can;

public class Distribution {


	public static double poissonRandNum(double lambda){

		double random;
		do{
			random = Math.random();
		}while(random==0);
		return -Math.log(Math.random())/lambda;
		
	}
	public static int geometricRandNum(double p)
	{
		int result;
		do{
		 result = (int)Math.floor( Math.log( Math.random() ) / Math.log( 1.0D - p ) );
		}while(result==0);
			return result;
	}
		 // the next() method returns an rank id. The frequency of returned rank ids are follows Zipf distribution.


}
